package com.adaxi.adc.business.manager.controller;

import com.adaxi.adc.business.manager.pojo.Vehicle;
import com.adaxi.adc.business.manager.service.VehicleService;
import com.adaxi.adc.business.manager.service.impl.VehicleServiceImpl;
import com.adaxi.adc.business.manager.service.impl.VehicleTripServiceImpl;
import com.adaxi.adc.common.common.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Api(tags = "学员参考案例[后台管理系统]接口", value = "ExampleController")
public class CarController {
    @Autowired
    VehicleServiceImpl vehicleService;
    @GetMapping("/sbsb-xiaoshuai")
    @ApiOperation(value = "查询车辆信息", notes = "查询车辆信息")
    public CommonResult  queryvehicle(Long id){
        List<Vehicle> vehicles=vehicleService.VehicleList(id);
        return CommonResult.SUCCESS("查询成功",vehicles);
    }

    @GetMapping("/car")
    @ApiOperation(value = "查询车辆信息", notes = "查询车辆信息")
    public CommonResult queryPage(){
        List<Vehicle> ve =vehicleService.list();
        return  CommonResult.SUCCESS("车辆查询成功",ve);
    }

    @ApiOperation("修改禁用")
    @PutMapping("/car/update/{id}")
    public CommonResult updateById(@PathVariable("id") Long id, @RequestBody Vehicle vehicle) {
        vehicle.setId(id);
        vehicleService.updateById(vehicle);
        return CommonResult.SUCCESS("修改成功",vehicle);
    }


}
